{% extends "base.html" %}
{% load i18n %}
{% load static %}
{% load wger_extras %}

{% block title %}{% translate "Gym list" %}{% endblock %}


{% block content %}

    <ul class="list-group">
        {% for gym in gym_list %}
            <li class="list-group-item list-group-item-action">
                <div class="btn-group float-end">
                    <button type="button" class="btn btn-dark dropdown-toggle btn-sm" data-bs-toggle="dropdown">
                        <span class="{% fa_class 'cog' %}"></span>
                    </button>
                    <div class="dropdown-menu dropdown-menu-right" role="menu">
                        {% translate 'Edit' as text %}
                        {% url 'gym:gym:edit' gym.id as url %}
                        {% modal_link url=url text=text css_class='dropdown-item' %}

                        {% translate 'Delete' as text %}
                        {% url 'gym:gym:delete' gym.id as url %}
                        {% modal_link url=url text=text css_class='dropdown-item' %}
                    </div>
                </div>
                <a href="{% url 'gym:gym:user-list' gym.pk %}">{{ gym }}</a>
            </li>
            {% empty %}
            <li class="list-group-item">
                {% translate "Nothing found" %}
            </li>
        {% endfor %}
    </ul>
{% endblock %}




{% block sidebar %}
    {% if perms.config.change_gymconfig %}
        <div class="btn-group float-end">
            <button type="button" class="btn btn-light dropdown-toggle btn-sm" data-bs-toggle="dropdown">
                {% translate "Actions" %} <span class="caret"></span>
            </button>
            <div class="dropdown-menu" role="menu">
                {% translate 'Edit' as text %}
                {% modal_link url='config:gym_config:edit' text=text css_class='dropdown-item' %}
            </div>
        </div>
    {% endif %}
    <h4>{% translate "Global gym configuration" %}</h4>
    <table class="table">
        <tr>
            <th>{% translate "Default gym" %}</th>
            <td>{{ global_gym_config.default_gym|default:"-/-" }}</td>
        </tr>
    </table>
{% endblock %}



{#         #}
{# Options #}
{#         #}
{% block options %}
{% if perms.gym.add_gym %}
    {% translate 'Add new gym' as text %}
    {% modal_link url='gym:gym:add' text=text  %}
{% endif %}
{% endblock %}
